﻿using System;
using System.Threading;

namespace Program14
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("主线程");
            Thread t = new Thread(new ThreadStart(ThreadProc));
            t.Start();
            //终止线程sss
            //t.Abort();

            for(var i = 0;i<4;i++)
            {
                Console.WriteLine("主线程：做别的事");
                Thread.Sleep(0);
            }
            Console.WriteLine("主线程：要等ThreadProc执行完成");
            //阻塞调用线程，直到某个线程执行完成为止
            t.Join();

            for (var i = 0; i < 5; i++)
            {
                Console.WriteLine("ThreadProc:+{0}", i);
            }
         
        }
        static void ThreadProc()
        {
            for(var i = 0;i<10;i++)
            {
                Console.WriteLine("ThreadProc:+{0}", i);
            }
        }
    }
}
